import { type Skill, SkillType, TargetType } from './Skill';
import { type Character } from './Character';

export const skills = {
    // 主动技能
    powerStrike: {
        name: '强力一击',
        type: SkillType.Active,
        targetType: TargetType.Enemy,
        execute: (caster: Character, target: Character, log?: (message: string) => void) => {
            const damage = caster.calculateDamage(caster, target, 1.2); // 伤害率为 1.2
            const remainingHealth = Math.max(0, target.health - damage);
            log?.(`${caster.name} 触发主动技能【强力一击】，对 ${target.name} 造成 ${damage} 点伤害！【剩余血量：${remainingHealth}】`);
            target.takeDamage(damage);
        }
    },

    // 谋略技能
    fireAttack: {
        name: '火攻',
        type: SkillType.Strategy,
        targetType: TargetType.Enemy,
        execute: (caster: Character, target: Character, log?: (message: string) => void) => {
            const damage = caster.calculateDamage(caster, target, 1.5); // 伤害率为 1.5
            const remainingHealth = Math.max(0, target.health - damage);
            log?.(`${caster.name} 触发谋略技能【火攻】，对 ${target.name} 造成 ${damage} 点谋略伤害！【剩余血量：${remainingHealth}】`);
            target.takeStrategyDamage(damage);
        }
    }
};